<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context-3.0.xsd">


    <!-- Scans for application @Components to deploy -->
    <context:component-scan base-package="org.encuestame.business.service" />
    <context:component-scan base-package="org.encuestame.business.setup" />
    <context:component-scan base-package="org.encuestame.core.service" />
    <context:component-scan base-package="org.encuestame.social.connect.service" />

    <!-- Social Support -->
    <import resource="encuestame-test-service-social-context.xml" />

    <!-- Message Resources -->
    <bean id="messageSource"
        class="org.springframework.context.support.ResourceBundleMessageSource">
        <property name="basename">
            <value>messages</value>
        </property>
    </bean>
    
    
    <bean class="org.encuestame.core.service.MessageSourceFactoryBean">
       <constructor-arg  index="0" ref="messageSource"/>
    </bean> 

    <!-- Startup Support -->
    <bean id="install" class="org.encuestame.business.setup.install.DatabaseInstall"
        scope="singleton" />
    <bean id="applicationStartup" class="org.encuestame.business.setup.ApplicationStartup"
        scope="singleton" />
    <!--  Gadget Support -->
    <bean id="gadgetLoader" init-method="load" class="org.encuestame.business.gadgets.GadgetsLoader" scope="singleton">
       <property name="gadgets">
          <list>
            <value>classpath:org/encuestame/business/gadgets/activity-stream.properties</value>
            <value>classpath:org/encuestame/business/gadgets/comments.properties</value>
            <value>classpath:org/encuestame/business/gadgets/tweetpoll-votes.properties</value>
          </list>
        </property>
    </bean>
    
    <bean id="reindexAttachmentJob" class="org.encuestame.business.search.ReIndexAttachmentsJob"/>
    <bean id="reIndexJob" class="org.encuestame.core.cron.ReIndexJob"/>
    <bean id="indexRebuilder" class="org.encuestame.core.cron.IndexRebuilder"/>
    <bean id="calculateHashTagSize" class="org.encuestame.core.cron.CalculateHashTagSize"/>
    <bean id="calculateRelevance" class="org.encuestame.core.cron.CalculateRelevance"/>
    <bean id="removeAccountJob" class="org.encuestame.business.cron.RemoveUnconfirmedAccountJob"/>

    <!-- setup data source -->

    <bean id="jdbcSetupDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
        <property name="url" value="jdbc:hsqldb:mem:encuestame_demo"/>
        <property name="username" value="sa"/>
        <property name="password" value=""/>
    </bean>

    <bean id="jdbcSetupTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
        <property name="dataSource" ref="jdbcSetupDataSource"/>
    </bean>

    <bean id="installDaoTest" class="org.encuestame.persistence.dao.jdbc.InstallerDao">
        <property name="jdbcTemplate" ref="jdbcSetupTemplate"></property>
    </bean>

    <bean id="databaseInstallTest" class="org.encuestame.business.setup.install.DatabaseInstall">
        <property name="installerOperations" ref="installDaoTest"></property>
    </bean>

</beans>
